<?php
namespace Tools\Controller;
use Common\Controller\HomebaseController;

/**
 * 大事记首页
 */
class  TimelineController extends HomebaseController {

	/**
	 * [index 大事记显示]
	 * @return [type] [description]
	 */
	public function index() {

		$lists = D('ToolsTimeline')->order('timeline_year_month asc')->select();
		foreach ($lists as $key => $value) {
			$lists[$key]['time_year'] = date('Y',$value['timeline_year_month']);
			$lists[$key]['time_month'] = date('m',$value['timeline_year_month']);
		}

		//根据相同的键值进行合并
		$result= array();
		foreach ($lists as $key => $list) {
			$result[$list['time_year']][] = $list;
		}

		//赋值
		$this->assign('result', $result);
		$this->display("index");
	}

}
